<?php
namespace Realisation\Web\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Silex\Application;

/**
 * Description of AbstractApiController
 *
 * @author pahhan
 */
class LogController
{
    public function request(Request $request, Application $app)
    {
        $response = new Response();
        $response->headers->set('content-type', 'text/plain');
        $log_file = $app['monolog.api.logfile'];
        if( is_readable($log_file) ) {
            $response->setContent(file_get_contents($log_file));
        }
        else {
            $response->setContent('Can\'t read log file. May be it not exists yet.');
        }
        
        return $response;
    }
}
